package router

import (
	"github.com/gin-gonic/gin"
	"project-im/config"
	"project-im/internal/api/user"
	"project-im/internal/api/websocket"
	"project-im/tools"
)

func Router(r *gin.Engine) {
	r.GET("im", websocket.Start)
	router := r.Group("api")
	{
		//登录
		router.POST("login", user.Login)
		//注册
		router.POST("register", user.Register)
		//上传
		router.POST("upload", user.Upload)
		//用户
		UserRouter(router)
		//好友
		FriendRouter(router)
		//群聊
		GroupRouter(router)
		//消息
		SysTemRouter(router)
		//上传
		Upload(router)
		//修改密码
		router.Use(tools.JWTAuth(config.AppConfig.Jwt.Key))
		router.PUT("modifyPwd", user.Update)
		//聊天
		MessageRouter(router)
	}
}
